// pages/cancelCard/cancelCard.js

var app = getApp();
var page=1;
var selectedNews = false;
var newsList = [];

Page({
  data:{
    listdefault:1,
    card: {}
  },
  onLoad:function(options){
    // 页面初始化 options为页面跳转所带来的参数
    var that = this;
    var cards = JSON.parse(options.info);
    cards.card_number = cards.card_number.slice(cards.card_number.length - 4, cards.card_number.length);
    that.setData({
      card: cards
    })    
  },
  //点击解绑银行卡
  bindCancelTap: function (e) {
    var id = e.currentTarget.dataset.id;
    var url = '/wallet_api/bankDel';
    var params = {
      id: id
    };
    app.HttpPostSend(url, params, function (res) {
      if (res.code == "-1") {
        app.showTipMsg(res.data);
      } else {
        app.showTipMsg('解除银行卡成功');
        wx.navigateBack({
          url: '../myBankCard/myBankCard?backtype=money'
        })
      }
    });
  },
  onReady:function(){
    // 页面渲染完成
  },
  onShow:function(){
    // 页面显示
  },
  onHide:function(){
    // 页面隐藏
  },
  onUnload:function(){
    // 页面关闭
  },
  // onShareAppMessage: function () {
    
  // },
  /** 
   * 页面上拉触底事件的处理函数 
   */
  onReachBottom: function () {
    
  }
})